package org.hrqing.authorization.entity.mapper;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.domain.Persistable;

/**
 * @auther Hrqing
 */
@Getter
@Setter
@MappedSuperclass
public abstract class BaseEntity implements Persistable<String> {

    @Id
    private String id;

    @Override
    @JsonIgnore
    public boolean isNew() {
        return this.id == null || this.id.trim().isEmpty();
    }
}
